<div class="card-block bg-white">
  <div class="block">
    <h4 class="first">基本信息</h4>
    <div class="row">
      <div class="col-md-2">
        <span>标题</span> <span class="font-red">*</span>
      </div>
      <div class="col-md-10">
        <input #titleName=ngModel minlength="0" maxlength="80" [(ngModel)]="newSet.name" type="text" class="from-control input" placeholder="请输入 1 - 80 个字符作为题目标题" required/>
        <!--<span [style.color]="titleName.valid ? 'black':'red'">{{titleName.errors|json}}</span>-->
        <div style="color: red;" *ngIf="titleName.errors?.required">请输入标题</div>
        <div style="color: red;" *ngIf="titleName.errors?.minlength">should be 3 chacaters</div>
      </div>
    </div>
    <div *ngIf="user.role!='admin'" class="row">
      <div class="col-md-2">
        <span>类型</span> <span class="font-red">*</span>
      </div>
      <div class="col-md-10">
        <div class="row form-group">
          <div class="col-md-3 col-sm-3">
            <label>
              <input type="radio" *ngIf="newSet.type==1||newSet==null" checked  name="type" value="exercise" (click)="clickRadio($event)">
              <input type="radio" *ngIf="newSet.type==0"  name="type" value="exercise" (click)="clickRadio($event)">
              <span>练习</span>
            </label>
          </div>
          <div class="col-md-3 col-sm-3">
            <label>
              <input type="radio" *ngIf="newSet.type==0" checked name="type" value="exam" (click)="clickRadio($event)">
              <input type="radio" *ngIf="newSet.type==1||newSet==null" name="type" value="exam" (click)="clickRadio($event)">
              <span>考试</span>
            </label>
          </div>
        </div>
        <div class="row form-group">
          <div class="col-md-12 col-sm-12">
            <div class="my-alert-warning" role="alert">{{alertMessage}}</div>
          </div>
        </div>
      </div>
    </div>
    <div class="row">
      <div class="col-md-2">
        <span>时间类型:</span> <span class="font-red">*</span>
      </div>
      <div class="col-md-10">
        <div>
          <label>
            <input (click)="clickTimeRadio($event)" type="radio" name="timeType" value="fixed_duration" checked><span>固定时长</span>
            <div *ngIf="timeRadio=='fixed_duration'">
              <p-calendar dateFormat="yy-mm-dd" [(ngModel)]="rangeDates"
                          placeholder="选择开始时间和结束时间" [showTime]="true"
                          [inputStyle]="{'width':'250px'}" (onSelect)="selectTime($event)"
                          selectionMode="range" readonlyInput="true"></p-calendar>
              <div style="color: red;" *ngIf="selectTimeFlag">请选择开始、结束时间</div>
              <!--<div class="row">
                <div class="col-sm-3 col-md-3">时长</div>
                <div class="col-sm-8 col-md-8">
                  <input class="col-sm-7 col-md-7" value="{{countM}}" readonly><div style="font-size: 0.875rem;" class="col-sm-5 col-md-5">分钟</div>
                </div>
              </div>-->
            </div>
          </label>
        </div>
        <!--<div>
          <label>
            <input (click)="clickTimeRadio($event)" type="radio" name="timeType" value="fixed_time"><span>固定时间</span>
            <div *ngIf="timeRadio=='fixed_time'">
              <p-calendar dateFormat="yy-mm-dd" [(ngModel)]="rangeDates"
                          placeholder="选择开始时间和结束时间" [showTime]="true"
                          [inputStyle]="{'width':'250px'}" (onSelect)="selectTime($event)"
                          selectionMode="range" readonlyInput="true"></p-calendar>
            </div>
          </label>
        </div>-->
      </div>
    </div>
    <div class="row">
      <div class="col-md-2">
        <span>编译器限制</span> <span class="font-red">*</span>
      </div>
      <div class="col-md-4">
        <p-checkbox label="C(gcc)" name="groupName" value="C(gcc)" [(ngModel)]="selectedValues"></p-checkbox>
        <p-checkbox label="Java(openjdk)" name="groupName" value="Java(openjdk)" [(ngModel)]="selectedValues"></p-checkbox>
        <div style="color: red;" *ngIf="selectedValues==null?true:false||selectedValues.length==0">请选择至少一个编译器</div>
      </div>
    </div>
    <!--<div class="row">-->
      <!--<div class="col-md-2">-->
        <!--<span>设置题目集状态</span>-->
      <!--</div>-->
      <!--<div class="col-md-4">-->

      <!--</div>-->
    <!--</div>-->
    <div class="row">
      <div class="col-md-2">
        <span>公告</span>
      </div>
      <div class="col-md-8">
        <textarea [(ngModel)]="newSet.notice" pInputTextarea rows="7" style="width: 100%;resize:none;"></textarea>
      </div>
    </div>
    <div style="text-align: center;">
      <p-button (onClick)="saveNewSet()" label="{{btnLabel}}"></p-button>
    </div>
  </div>
</div>



